import { createRouter, createWebHistory } from "vue-router"
import { useTagStore } from '@/stores'

const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            path: '/',
            component: () => import('@/layouts/MainLayout.vue'),
            name: 'home',
            meta: {
                title: '首页',
            },
            children: [
                {
                    path: '',
                    name: 'home-index',
                    component: () => import('@/pages/home.vue'),
                    hidden: true
                },
            ],
        },
        {
            path: '/login',
            component: () => import('@/pages/login.vue')
        },
        {
            path: '/system',
            component: () => import('@/layouts/MainLayout.vue'),
            meta: {
                title: '系统管理'
            },
            children: [
                {
                    path: '/admin',
                    name: 'system-admin',
                    component: () => import('@/pages/admin.vue'),
                    meta: {
                        title: '管理员管理'
                    }
                },
                {
                    path: '/permission',
                    name: 'system-permission',
                    component: () => import('@/pages/permission.vue'),
                    meta: {
                        title: '权限管理'
                    }
                },
                {
                    path: '/role',
                    name: 'system-role',
                    component: () => import('@/pages/role.vue'),
                    meta: {
                        title: '角色管理'
                    }
                },
            ]
        },
    ]
})

router.beforeEach(g => {
    /*if (to !== '/login') {
        return '/login'
    }*/
})

router.afterEach(g => {

})

export default router